<?php


namespace App\Models;


use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Attention extends Model
{
    use HasFactory;

    protected $table='attentions';

    //一个用户可以关注多个房源
    public function residential()
    {

        return $this->hasOne(Residential::class, 'id', 'fang_id');
    }

    public static function getAttention($uid)
    {
        $data=Attention::with('residential')->where('uid',$uid)->get()->toArray();
        return $data;
    }
}
